-
Notifications
You must be signed in to change notification settings - Fork 5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Integrate new TokenListController
polling pattern [Extension]
#28198
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ask-extension into brian/asset-controller-39
… brian/currency-rate-multichain-polling2
…MetaMask/metamask-extension into brian/multiexchangerate
gambinish
changed the title
3429 tokenlist controller polling
feat: Integrate new Nov 1, 2024
TokenListController
polling pattern [Extension]
4 tasks
…sk/metamask-extension into 3429_tokenlist-controller-polling
@metamaskbot update-policies |
Policies updated. 🧠 Learn how: https://lavamoat.github.io/guides/policy-diff/#what-to-look-for-when-reviewing-a-policy-diff |
…sk/metamask-extension into 3429_tokenlist-controller-polling
gambinish
added a commit
to MetaMask/core
that referenced
this pull request
Nov 5, 2024
## Explanation _TokenListController is currently responsible for maintaining a list of all tokens per chain. This dataset is accessible via `tokenList` state variable in metamask state. After this task is complete, this token list will migrate it's polling pattern to leverage the base class, to execute a single poll per chain, rather than on an interval for all chains_ ___ Move `TokenListController` away from being scoped to a single polling loop, to executing individual polling loops per chain, allowing it to be more UI based in its controls. The controller will accept `PollingInputs` from the extension from various UI elements, and will be responsible for starting, stopping, and deduping polls as needed. Deduping is baked into the inherited base class `StaticIntervalPollingController` Here is the corresponding [PR in extension](MetaMask/metamask-extension#28198) that consumes and integrates with this controller. There will also be an additional mobile PR at some point to implement something similar. ## References MetaMask/MetaMask-planning#3429 ## Changelog <!-- If you're making any consumer-facing changes, list those changes here as if you were updating a changelog, using the template below as a guide. (CATEGORY is one of BREAKING, ADDED, CHANGED, DEPRECATED, REMOVED, or FIXED. For security-related issues, follow the Security Advisory process.) Please take care to name the exact pieces of the API you've added or changed (e.g. types, interfaces, functions, or methods). If there are any breaking changes, make sure to offer a solution for consumers to follow once they upgrade to the changes. Finally, if you're only making changes to development scripts or tests, you may replace the template below with "None". --> ### `@metamask/package-a` - **<CATEGORY>**: Your change here - **<CATEGORY>**: Your change here ### `@metamask/package-b` - **<CATEGORY>**: Your change here - **<CATEGORY>**: Your change here ## Checklist - [ ] I've updated the test suite for new or updated code as appropriate - [ ] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [ ] I've highlighted breaking changes using the "BREAKING" category above as appropriate - [ ] I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes
closing in favor of: #28447 |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
TokenListController is currently responsible for maintaining a list of all tokens per chain. This dataset is accessible via tokenList state variable in metamask state. After this task is complete, this token list will expand to poll tokenList across each network added to any given wallet. This will result in a larger dataset for the to consume.
This PR branches off of multiexchangerate branch because it will incorporate the
useMultiPolling
hook needed to initialize polling loops across chainIds.For each chain imported into the wallet, we should start a new polling loop and update
tokensChainsCache
. We also want to updatetokenList
for the selected chain (this should eventually be deprecated)This should now be working to test locally. Here's some steps to run this locally with core PR:
"@metamask/assets-controllers": "../core/packages/assets-controllers",
useTokenListPolling
hook inTokenListProvider
to a variable and log it:DEFAULT_INTERVAL
to 3 seconds:const DEFAULT_INTERVAL = 3 * 1000;
Build core, install on extension, and run extension.
Related issues
Fixes: https://github.com/MetaMask/MetaMask-planning/issues/3429
Manual testing steps
tokensChainsCache
polls imported chainIds (one poll per network)tokenList
gets updated with metadata for the current chain onlyScreenshots/Recordings
Screen.Recording.2024-10-31.at.3.45.27.PM.mov
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist